home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / GPC2952B.ZIP / doc / gpc / docdemos / demomodule.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-02-09  |  881 b   |  49 lines

  1. module DemoModule interface;  { interface part }
  2.         
  3. export DemoModule = (FooType, SetFoo, GetFoo);
  4.  
  5. type
  6.   FooType = Integer;
  7.  
  8. procedure SetFoo (f : FooType);
  9. function  GetFoo : FooType;
  10.  
  11. end.
  12.  
  13. module DemoModule implementation;  { implementation part }
  14.  
  15. import
  16.   StandardInput;
  17.   StandardOutput;
  18.  
  19. var
  20.   Foo : FooType;
  21.  
  22. { Note: the effect is the same as a `forward' directive would have:
  23.   parameter lists and return types are not allowed in the
  24.   declaration of exported routines, according to EP. In GPC, they
  25.   are allowed, but not required. }
  26. procedure SetFoo;
  27. begin
  28.   Foo := f
  29. end;
  30.  
  31. function GetFoo;
  32. begin
  33.   GetFoo := Foo
  34. end;
  35.  
  36. to begin do
  37.   begin
  38.     foo := 59;
  39.     WriteLn ('Just an example of a module initializer. See comment below')
  40.   end;
  41.  
  42. to end do
  43.   begin
  44.     Foo := 0;
  45.     WriteLn ('Goodbye')
  46.   end;
  47.         
  48. end.
  49.